修复 gyp No Xcode or CLT version detected 报错

LeoKnight
March 19th, 2020

问题原因

当项目中依赖 mozjpeg 这个依赖,安装是会报如下错误

alt text for small image
1gyp: No Xcode or CLT version detected!
2gyp ERR! configure error

虽然本机已经安装过 comman line tools ,怀疑是因为系统版本升级到 catalina 导致,所以解决方案是把旧的删掉,重新装

解决方案

寻找到旧的安装地址

1xcode-select --print-path

如果没有以为,预期结果为 /Library/Developer/CommandLineTools 执行删除

1sudo rm -r -f /Library/Developer/CommandLineTools

安装

1xcode-select --install

执行期间会让你输入秘密,按提示操作即可

alt text for small image

欢迎订阅我的频道

输入邮箱您将加入到我的邮箱组中,当有文章更新时,您将第一时间得到推送,保护隐私是我的做人准则,您的邮箱不会被第三方获取。

More articles from LeoKnight